{% extends "baseUser.html" %}

{% block userData %}
	<div class="page-header">
		<div class="row">
			<div class="col-md-10">
				<h1>Modificar perfil</h1>
			</div>
		</div>
	</div>

	<div class="container">
		<div class="row">
		
			{% with messages = get_flashed_messages() %}
			  {% if messages %}
			    <div class="alert alert-info">
			    {% for message in messages %}
			      {{ message }}
			    {% endfor %}
			    </div>
			  {% endif %}
			{% endwith %}
		
			<div class="col-md-12">

				<form action="{{ url_for('upload') }}" method=post enctype="multipart/form-data">
					<div class="form-group  ">
				        <label for="photo" class="control-label"><label for="photo">{{ form.photo.label }}</label></label>
				        <input class="form-control" id="photo" name="photo" placeholder="Photo" type="file">
				    </div>
       				<input type=submit class="btn btn-default" value=Upload>
				</form>
					
						
				{% call macros.render_form(form, action_url=url_for('profile'), action_text='Actualizar') %}
					{{ macros.render_field(form.apodo, label_visible=true, placeholder='Apodo', type='text') }}
	                {{ macros.render_field(form.nombre, label_visible=true, placeholder='Nombre', type='text') }}
	                {{ macros.render_field(form.apellido, label_visible=true, placeholder='Apellido', type='text') }}
	                {{ macros.render_field(form.fechaNacimiento, label_visible=true, placeholder='Fecha Nacimiento', type='text') }}
	                {{ macros.render_field(form.email, label_visible=true, placeholder='Email', type='email') }}
	                {{ macros.render_field(form.direccion, label_visible=true, placeholder='Direccion', type='text') }}
	                
	                {% for deporte in deportes %}
						{% set check = '' %}
						{% if deporte in deportes_del_usuario %}									
							{% set check = 'checked' %}
						{% endif %}
						
						<div class="checkbox">
					        <label>
					        	<p><input {{check}} type="checkbox" name="deportesList" value={{ deporte.nombre }}>{{deporte.nombre}}
					        </label>
					    </div>
					{% endfor %}
               
	                
            	{% endcall %}
			
			</div>
		</div>
	</div>
{% endblock %}